package com.youhp.spire.xls.demo.Data.RichText;

import com.spire.xls.*;

public class ReadRichText {

    public static void main(String[] args) {

        Workbook workbook = new Workbook();
        workbook.loadFromFile("data/ReadRichText.xlsx");
        Worksheet sheet = workbook.getWorksheets().get(0);
        //Get the rich text
        String text = sheet.getCellRange("A1").getRichText().getRtfText();
        //Create a new workbook
        Workbook workbook1 = new Workbook();
        Worksheet sheet1 = workbook1.getWorksheets().get(0);
        //Add the rich text to the new workbook
        RichText richText = sheet1.getCellRange("A1").getRichText();
        richText.setText(text);
        //Save to file
        workbook.saveToFile("output/ReadRichText.xlsx", ExcelVersion.Version2013);
    }
}
